﻿<%@ Page Language="C#" MasterPageFile="~/cms/cms.master" AutoEventWireup="true" CodeFile="services.aspx.cs" Inherits="cms_product" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="main-title">Dịch vụ:</div>
    <div class="main-content">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" 
                    BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="0px" 
                    DataKeyNames="serviceID" ForeColor="Black"
                    ToolTip="Click vào tiêu đề để cập nhật chi tiết"
                    Width="100%" AllowPaging="True" DataSourceID="sdsSource">
                    <Columns>
                        <asp:TemplateField HeaderText="Tên dịch vụ">
                            <ItemTemplate>
                                <a href='<%# "service.aspx?serviceID="+Eval("serviceID") %>'><%# Eval("title") %></a>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="txtName" Text='<%# Bind("title") %>'
                                 Width="280px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvName" ControlToValidate="txtName"
                                 runat="server" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Service name">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblTitleE" Text='<%# Eval("enTitle") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="txtNameE" Text='<%# Bind("enTitle") %>'
                                 Width="280px"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvNameE" ControlToValidate="txtNameE"
                                 runat="server" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <ItemStyle HorizontalAlign="Left" Width="300px" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False">
                            <EditItemTemplate>
                                <div style="width:55px; text-align:center;">
                                    <asp:LinkButton ID="lbtUpdate" runat="server" CausesValidation="False" 
                                        CommandName="Update" ToolTip="Lưu thay đổi">
                                        <img alt="Ghi lại thay đổi" src="../images/save.gif" style="border:none;" />
                                    </asp:LinkButton>
                                    <asp:LinkButton ID="lbtCancel" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" ToolTip="Bỏ qua">
                                        <img alt="Hủy bỏ" src="../images/cancel.gif" style="border:none;" />
                                    </asp:LinkButton>
                                </div>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:LinkButton ID="lbtEdit" runat="server" CausesValidation="False" 
                                    CommandName="Edit" ToolTip="Sửa">
                                    <img alt="Sửa thông tin" src="../images/updaterow.gif" style="border:none;" />
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle Width="60px" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False">
                            <ItemTemplate>
                                <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" 
                                    CommandName="Delete" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa?');">
                                    <img alt="Xóa" src="../images/delete_over.gif" style="border:none;" title="Xóa dòng này" />
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle Width="30px" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="gridHeader" />
                    <RowStyle CssClass="gridRow" />
                    <PagerStyle CssClass="gridPage" />
                    <FooterStyle CssClass="gridFooter" />
                    <EmptyDataTemplate>
                        Chưa có dữ liệu trong hệ thống!
                    </EmptyDataTemplate>
                </asp:GridView>
                <div class="gridviewAddNewButton">
                    <a href="service.aspx">Đăng bài mới</a>
                </div>
                <asp:SqlDataSource ID="sdsSource" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:hotb %>" 
                    DeleteCommand="_serviceDelete" DeleteCommandType="StoredProcedure" 
                    SelectCommand="_serviceGetListForCMS" SelectCommandType="StoredProcedure" 
                    UpdateCommand="_serviceUpdate" UpdateCommandType="StoredProcedure">
                    <DeleteParameters>
                        <asp:Parameter Name="serviceID" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="serviceID" Type="Int32" />
                        <asp:Parameter Name="title" Type="String" />
                        <asp:Parameter Name="enTitle" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>

